<template>
    <div class="mui-numbox" data-numbox-min="1">
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="initcount" @change="getInputValue" ref="numbox" readonly>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script>
    // 引入 mui.js文件
    import mui from '../../lib/mui/js/mui.min.js'
    export default {
        mounted() {
            // 初始化 numbox 插件
            mui('.mui-numbox').numbox()
        },
        methods: {
            // 子组件 向 GoodsInfo.vue 父组件 传值
            getInputValue(){
                this.$store.commit('updateCount',{
                    id: this.goodsid,
                    count: this.$refs.numbox.value
                })
            }
        },
        props: ['initcount','goodsid']       
    }
</script>

<style lang="less" scoped>

</style>
